import wx
import wx.lib.agw.aui as aui

class EditToolBar(aui.AuiToolBar):

    name = "Edit Toolbar"
    _id = "rwb.toolbar.edit"
    
    def __init__(self, parent):
        aui.AuiToolBar.__init__(self, parent, wx.ID_ANY, style=aui.AUI_TB_TEXT|wx.WS_EX_PROCESS_UI_UPDATES)
        # self.AddTool(ID_RUN, "Run", 
        #              getPlayImageBitmap(), wx.NullBitmap, wx.ITEM_NORMAL, 
        #              "run", "start running, or continue running after a breakpoint", "42")

        file_open_image = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, (16,16))
        file_save_image = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_TOOLBAR, (16,16))
        cut_image = wx.ArtProvider.GetBitmap(wx.ART_CUT, wx.ART_TOOLBAR, (16,16))
        copy_image = wx.ArtProvider.GetBitmap(wx.ART_COPY, wx.ART_TOOLBAR, (16,16))
        paste_image = wx.ArtProvider.GetBitmap(wx.ART_PASTE, wx.ART_TOOLBAR, (16,16))
        self.AddTool(wx.ID_OPEN, "Open", 
                     file_open_image, wx.NullBitmap, wx.ITEM_NORMAL,
                     "open", "open file", None)
        self.AddTool(wx.ID_SAVE, "Save", 
                     file_save_image, wx.NullBitmap, wx.ITEM_NORMAL,
                     "save", "save changes", None)
        self.AddSeparator()
        self.AddTool(wx.ID_CUT, "Cut", 
                     cut_image, wx.NullBitmap, wx.ITEM_NORMAL,
                     "cut", "cut selected text to clipboard", None)
        self.AddTool(wx.ID_COPY, "Copy", 
                     copy_image, wx.NullBitmap, wx.ITEM_NORMAL,
                     "copy", "copy selected text to clipboard", None)
        self.AddTool(wx.ID_PASTE, "Paste", 
                     paste_image, wx.NullBitmap, wx.ITEM_NORMAL,
                     "paste", "paste contents of clipboard", None)
        self.AddSeparator()
        # self.AddTool(ID_ROBOT_VALIDATION, "QC",
        #              wx.NullBitmap, wx.NullBitmap, wx.ITEM_NORMAL,
        #              "quality check", "perform static analysis of test case", None)

        parent.auimgr.AddPane(self, aui.AuiPaneInfo().
                              ToolbarPane().Top().Floatable(False).Gripper(True).
                              Name("rwb.toolbar.edit").Movable(True).Resizable(False).Show(False)
                              )
        # without this, auibar throws an "object has no attribute '_absolute_min_size' 
        # error. 
        self.Realize()

